<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>重复字符串</title>
</head>

<body>
    <script type="text/javascript">
    function repeatStringNumTimes(str, num) {
        // repeat after me
        let news = "";
        while (num > 0) {
            news += str;
            num--;
        }
        return news;
    }

    repeatStringNumTimes("abc", 3);


    // repeat(,) 可以直接实现
    </script>
</body>

</html>